package com.cskaoyan.service;

import com.cskaoyan.bean.MarketGoodsAttribute;
import com.cskaoyan.mapper.MarketGoodsAttributeMapper;
import com.cskaoyan.util.MyBatisUtil;
import com.cskaoyan.util.TransactionUtil;

import java.util.Date;

public class GoodsAttributeServiceImpl implements GoodsAttributeService {
    @Override
    public int add(MarketGoodsAttribute attribute) {
        MarketGoodsAttributeMapper goodsAttributeMapper = TransactionUtil.getMapper(MarketGoodsAttributeMapper.class);
        Date now = new Date();
        attribute.setAddTime(now);
        attribute.setUpdateTime(now);

        return goodsAttributeMapper.insertSelective(attribute);
    }

    @Override
    public int flash(MarketGoodsAttribute attribute) {

        MarketGoodsAttributeMapper goodsAttributeMapper = MyBatisUtil.getMapper(MarketGoodsAttributeMapper.class);
        Date now = new Date();
//        attribute.setAddTime(now);
        attribute.setUpdateTime(now);


        int c = goodsAttributeMapper.updateByPrimaryKey(attribute);

        return c ;
    }
}

